package org.batallademusica.dominio;

import java.io.File;
import java.io.IOException;

import org.jaudiotagger.audio.*;
import org.jaudiotagger.audio.exceptions.CannotReadException;
import org.jaudiotagger.audio.exceptions.InvalidAudioFrameException;
import org.jaudiotagger.audio.exceptions.ReadOnlyFileException;
import org.jaudiotagger.tag.FieldKey;
import org.jaudiotagger.tag.Tag;
import org.jaudiotagger.tag.TagException;

public class Borrame2 {
	
	public static void main(String[] argc) throws CannotReadException, IOException, TagException, ReadOnlyFileException, InvalidAudioFrameException{
        File fichero = new File("d://temp/humanbehavior.mp3");
        if(fichero.exists()) System.out.println("El fichero existe");
		AudioFile f = AudioFileIO.read(fichero);
		Tag tag = f.getTag();
		AudioHeader audio = f.getAudioHeader();
		String tagstring=
		tag.getFirst(FieldKey.ARTIST)
		+"-"+tag.getFirst(FieldKey.ALBUM)
		+"-"+tag.getFirst(FieldKey.TITLE)
		+"-"+tag.getFirst(FieldKey.COMMENT)
		+"-"+tag.getFirst(FieldKey.YEAR)
		+"-"+tag.getFirst(FieldKey.TRACK)
		+"-"+tag.getFirst(FieldKey.DISC_NO)
		+"-"+tag.getFirst(FieldKey.COMPOSER)
		+"-"+tag.getFirst(FieldKey.ARTIST_SORT);
		System.out.println(tagstring);
		
		System.out.println(audio.getChannels());
		System.out.println(audio.getTrackLength());
		System.out.println(audio.getBitRateAsNumber());
	}
}
